﻿using System;

namespace MicroMVVM
{
    /// <summary>
    /// This attribute is used to define an exportable service.
    /// </summary>
    public class ExportService : Attribute
    {
        public ServiceType ServiceType { get; set; }

        public Type ExportType { get; set; }

        public PartCreationPolicy PartCreationPolicy { get; set; }

        /// <summary>
        /// Exports  a service.
        /// </summary>
        /// <param name="serviceType"></param>
        /// <param name="exportType"></param>
        public ExportService(ServiceType serviceType, Type exportType)
            : this(serviceType, exportType, PartCreationPolicy.Singleton)
        {
        }

        /// <summary>
        /// Exports  a service.
        /// </summary>
        /// <param name="serviceType"></param>
        /// <param name="exportType"></param>
        /// <param name="partCreationPolicy"></param>
        public ExportService(ServiceType serviceType, Type exportType, PartCreationPolicy partCreationPolicy)
        {
            ServiceType = serviceType;
            ExportType = exportType;
            PartCreationPolicy = partCreationPolicy;
        }
    }
}